

<template tag="以下文档内容为hycli自动生成">
  <el-dialog
    v-model="conf.visible"
    
    :title="title"
    :width="conf.width"
    draggable
    align-center="true"
    :close-on-click-modal="false"
  >
<el-form :model="form"  ref="form" :rules="rules_aaabu">
    <el-row>
    <el-col :span="12">
    <!-- {"index":36,"raw":"plan_id","name":"plan_id","cname":"PlanId","type":{"raw":"number(10)","name":"number","len":10,"dlen":0},"defValue":"0","allowNull":false,"constraints":["le","q","c","u","v","sl(dev_plan,-,#lob_id)","tp(readonly,u)"],"desc":{"raw":"研发计划","name":"研发计划"}} -->
     <!--研发计划 下拉控件 -->
    <el-form-item prop="plan_id" label="研发计划" label-width="100px" label-position="right">
      <el-select   v-model="form.plan_id" style="width: 100%" filterable clearable
        placeholder="请选择研发计划" disabled >
        <el-option v-for="item in plan_idList" :key="item.value" :label="item.name" :value="item.value" />
      </el-select>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":39,"raw":"pdstatus","name":"pdstatus","cname":"Pdstatus","type":{"raw":"number(2)","name":"number","len":2,"dlen":0},"defValue":"","allowNull":false,"constraints":["l","le","c","u","v","bq","sl","tp(radio,c-u)","color","cidx(102)","uidx(102)"],"desc":{"raw":"方案状态","name":"方案状态"}} -->
    <el-form-item prop="pdstatus" label="方案状态" label-width="100px" label-position="right">
      <el-radio-group v-model="form.pdstatus"   >
        <el-radio-button v-for="item in pdstatusList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":38,"raw":"name","name":"name","cname":"Name","type":{"raw":"varchar2(48)","name":"varchar2","len":48,"dlen":0},"defValue":"","allowNull":false,"constraints":["l","le","q","c","u","v","DN","urow(1)","lw(140)","#like","ps(full)"],"desc":{"raw":"名称","name":"名称"}} -->
    <!--名称 输入控件 -->
    <el-form-item prop="name" label="名称" label-width="100px" label-position="right">
      <el-input clearable style="width: 100%" v-model="form.name"  maxlength="48" 
      :rows="0"  placeholder="请输入名称"  />
      </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":40,"raw":"master","name":"master","cname":"Master","type":{"raw":"varchar2(64)","name":"varchar2","len":64,"dlen":0},"defValue":"","allowNull":false,"constraints":["l","le","c","u","v","fq","sl(dmaster,-,#lob_id)","tp(multiselect,q)","lw(80)","tp(radio,c-u)"],"desc":{"raw":"负责人","name":"负责人"}} -->
    <el-form-item prop="master" label="负责人" label-width="100px" label-position="right">
      <el-radio-group v-model="form.master"   >
        <el-radio-button v-for="item in masterList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":43,"raw":"content","name":"content","cname":"Content","type":{"raw":"varchar2(2000)","name":"varchar2","len":2000,"dlen":0},"defValue":"","allowNull":false,"constraints":["le","q","c","u","v","rows(6)","#like"],"desc":{"raw":"内容","name":"内容"}} -->
    <!--内容 输入控件 -->
    <el-form-item prop="content" label="内容" label-width="100px" label-position="right">
      <el-input clearable style="width: 100%" v-model="form.content"  maxlength="2000" 
      :rows="6"  type="textarea" show-word-limit  placeholder="请输入内容"  />
      </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":45,"raw":"first_review_time","name":"first_review_time","cname":"FirstReviewTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":false,"constraints":["le","c","u","q","v","gat","tp(daterange,q)","f(MM/dd HH时)","tp(datetime,c-u,yyyy/MM/dd 09:00:00)"],"desc":{"raw":"初评时间","name":"初评时间"}} -->
    <!--初评时间 日期控件 -->
    <el-form-item prop="first_review_time" label="初评时间" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.first_review_time" clearable type="datetime"
        placeholder="请选择初评时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":46,"raw":"final_review_time","name":"final_review_time","cname":"FinalReviewTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":false,"constraints":["le","c","u","q","v","gat","tp(daterange,q)","f(MM/dd HH时)","tp(datetime,c-u,yyyy/MM/dd 09:00:00)"],"desc":{"raw":"终评时间","name":"终评时间"}} -->
    <!--终评时间 日期控件 -->
    <el-form-item prop="final_review_time" label="终评时间" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.final_review_time" clearable type="datetime"
        placeholder="请选择终评时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    </el-row>
</el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="hide" icon="close">取消</el-button>
        <el-button type="primary" @click="save" icon="select">提交</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import rtext from "@/views/cmpnts/rtext.vue"
export default {
  components: {
    rtext
},
  data() {
    return {
      conf: {
        visible: false,
        width:"60%",
        uploadPath:this.$theia.env.join("/file/upload"),
      },
      title:"修改项目设计",
rules_aaabu:{
    plan_id:[{required:true,message:"请输入研发计划",trigger: 'blur'}],
    pdstatus:[{required:true,message:"请输入方案状态",trigger: 'blur'}],
    name:[{required:true,message:"请输入名称",trigger: 'blur'}],
    master:[{required:true,message:"请输入负责人",trigger: 'blur'}],
    content:[{required:true,message:"请输入内容",trigger: 'blur'}],
    first_review_time:[{required:true,message:"请输入初评时间",trigger: 'blur'}],
    final_review_time:[{required:true,message:"请输入终评时间",trigger: 'blur'}],
  },
    form:{
        plan_id:"",
        pdstatus:"",
        name:"",
        master:"",
        content:"",
        first_review_time:"",
        final_review_time:"",
    },
    plan_idList:[],
    pdstatusList:[],
    masterList:[],
    }
  },
  methods: {
    show(form) {
      this.conf.visible = true;
      this.loadEnums_aaabu()
      this.form = Object.assign(form,this.$route.params)
      this.get(form)
    },
      get(form){
        let that = this
        this.conf.loading = true
        let postForm = {}
        postForm.pd_id = form.pd_id
        this.$theia.http.get("/ws/project/design",postForm).then(res=>{
          that.form = Object.assign(that.form, res)
        //处理枚举重新绑定
          this.loadEnums_aaabu()
          that.conf.loading = false
        }).catch(res=>{
          let code = ((res||{}).response||{}).status||0
          let msg = `项目设计查询失败(${code})`
          that.$notify.error({title: '失败',message:msg ,duration:5000})
        })
    },
    save(){
        this.$refs.form.validate((v=>{
            if(v) this.onSave()
        }))
    },
    onSave(){
      let that = this
        let postForm = Object.assign({},this.form)
        //将数据保存到window缓存中
        window.task = postForm
        window.pd_id = null
        this.$theia.http.put("/ws/project/design",postForm).then(res=>{
            that.$notify.success({title: '成功',message: '项目设计保存成功',duration:5000})
            that.hide()
            that.$emit("onsaved")
        }).catch(res=>{
            let code = ((res||{}).response||{}).status||0
            let msg = `项目设计修改失败(${code})`
            that.$notify.error({title: '失败',message: msg,duration:5000})
        })
    },
    hide() {
      this.conf.visible = false;
      this.$refs.form.resetFields();
    },
     onUploadSuccess(response){
    },
    loadEnums_aaabu(){
        //研发计划
        this.plan_idList = this.$theia.enum.get("dev_plan","",this.$theia.user.get("lob_id"),false,"")
        //方案状态
        this.pdstatusList = this.$theia.enum.get("pdstatus","","" ,false,"")
        //负责人
        this.masterList = this.$theia.enum.get("dmaster","",this.$theia.user.get("lob_id"),false,"")
    },

  },
};
</script>

<style scoped>
.form_item_info{
  margin-left: 4px;
  color:#999;
}
.form_item_info:hover{
  cursor: pointer;
  font-weight: 500;
  color:#333;
}
</style>